package com.blue.gateway.config.fallback;

import com.blue.common.exception.JsonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 网关服务降级
 *
 * @author liulei
 * @version 1.0
 */
@RestController
public class ServiceFallBack {

    @GetMapping("/fallback")
    public JsonResult fallback(@RequestParam String project) {
        return JsonResult.failed(String.format("%s%s%s", "服务", project, "暂不可用【网关Hystrix自动降级，到达一定次数后熔断，隔一段时间后再恢复对该服务的调用】"));
    }
}
